package com.example.controller;
import com.example.pojo.Result;
import com.example.pojo.workProjectPojo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * ClassName:workProjectController
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/6/19 17:45
 * @Version 1.0
 */
@RestController
@Slf4j
public class workProjectController {
    @Autowired
    private com.example.service.workProjectService workProjectService;
    //向数据库中插入一行空数据
    @PostMapping("/insertWorkOne")
    public Result insertWorkOne(@RequestBody workProjectPojo workProjectPojo){
        //插入数据
        workProjectService.insertWorkOne(workProjectPojo);
        return Result.success();
    }
    //查询所有的数据
    @PostMapping("/queryAll")
    public Result queryAll(){
       List<workProjectPojo> list= workProjectService.queryAll();
       return Result.success(list);
    }
    //修改某一个字段，传入的是修改字符串的类型
    @PostMapping("/saveWorkProjectOne")
    public Result saveWorkProjectOne(@RequestBody Map<String, Object> parameters){
        workProjectService.saveWorkProjectOneStr(parameters);
        return Result.success();
    }
    //修改某一个字段，传入的是修改数字的类型
    @PostMapping("/saveWorkProjectOneNmb")
    public Result saveWorkProjectOneNmb(@RequestBody Map<String, Object> parameters){
        workProjectService.saveWorkProjectOneNmb(parameters);
        return Result.success();
    }

}
